{% extends "school/layout.html" %}

{% set page_title = translate('学生点评') %}

{% block content %}
<div class="m-teacher-list">
<div class="m-fixed-table-top">
	<div class="title">
		<div class="name handle_nav">
			<a href="{{ url_for('school.teacher_comment_list') }}">{{translate('待处理评价')}}</a>
			<a href="{{ url_for('school.sent_teacher_comment_list') }}" class="active">{{translate('已处理评价')}}</a>
		</div>
		<!-- <div class="search" style="display:inline-block;"> -->
		<div class="search" style="display:none;">
			<input type="text" class="form-control" placeholder="{{translate('姓名')}}">
			<input type="text" class="form-control" placeholder="yyyy-mm-dd" id="search_date">
			<a class="btn btn-default" style="vertical-align:top;">{{translate('查找')}}</a>
		</div>
		<!-- <p class="text">已完成点评数量：{{ pagination.total }}个</p> -->
	</div>
</div>
<ul class="comments m-ul-table">
	<li class="header">
		<span class="cell name">{{translate('姓名')}}</span>
		<span class="cell class_time">{{translate('上课时间')}}</span>
		<span class="cell pingfen">{{translate('系统/教师评分')}}</span>
		<span class="cell teacher_evaluate">{{translate('教师评价')}}</span>
		<span class="cell status">{{translate('当前状态')}}</span>
	</li>
	{% for c in teacher_comments %}
	<li class="row-li" id="comments_{{ c.id }}">
		<span class="cell name">{{ c.student.name }}</span>
		<span class="cell class_time">{{ c.session.start_at }} - {{ c.session.end_at }}</span>
		<span class="cell pingfen">{{ c.system_score | round(1) | replace('.0', '') }}/{{ (c.teacher_score or 0) | round(1) | replace('.0', '') }}</span>
		<span class="cell teacher_evaluate">
			{{ c.comment or '' }}
		</span>
		<span class="cell status">
			{{ c.STATUS_NAMES[c.status] }}
		</span>
	</li>
	{% endfor %}
</ul>


{% include "school/pagination.html" %}
</div>

<div class="modal">
	<div class="modal-dialog modal-sm">
		<div class="modal-content">
			<div class="modal-header">
				<h4 class="modal-title">{{translate('确定不评价吗？')}}</h4>
			</div>
			<div class="modal-body">
				<button class="btn btn-danger">{{translate('确定')}}</button>
				<button class="btn btn-default">{{translate('取消')}}</button>
			</div>
		</div>
	</div>
</div>

{% endblock %}

{% block js %}
<script type="text/javascript">
	$(function(){
		$('.modal-body button').bind('click',function(){
			$('div.modal').modal('hide');
		});
	});

	$('.btn_submit').click(function () {
		console.log(this);
		var id = $(this).attr('id').split('_')[1];
		var comment = $('#comment_' + id).val();
		$.post($(this).data('url'), {contents: comment});
	});

	$('#search_date').datetimepicker({
		format:'yyyy-mm-dd',
		autoclose:true,
		todayBtn:true,
		minView:2,
		language: 'zh-CN'
	});
	$('.handle_nav').delegate('a','click',function(){
		$('.handle_nav a').removeClass('active');
		$(this).addClass('active');
	});
</script>
{% endblock %}
